package com.tapstitch.scm.common.enums.config;

import com.bluebuck.quickboot.core.enums.Language;
import com.tapstitch.scm.common.utils.RequestInfoUtil;

/**
 * 国际化枚举
 */
public enum InternationalizationEnum {

    /** 通用信息 */
    SUCCESS("成功","Success"),
    SYS_ERROR("系统错误", "System error"),
    PARAM_ERROR("参数错误","Param error"),
    ;

    private final String chineseText;
    private final String englishText;


    InternationalizationEnum(String chineseText, String englishText) {
        this.chineseText = chineseText;
        this.englishText = englishText;

    }


    public String getChineseText() {
        return chineseText;
    }

    public String getEnglishText() {
        return englishText;
    }

    public String getText(Language language) {
        String title = null;
        switch (language) {
            case CHINESE:
                title = getChineseText();
                break;
            case US_ENGLISH:
            case UK_ENGLISH:
                title = getEnglishText();
                break;
            default:
                break;
        }
        return title;
    }

    public String getMessage() {
        return getText(RequestInfoUtil.getCurrentRequestLanguage());
    }

}
